<?php

class Back_Model_Mapper_Liens extends Jnd_Model_Mapper_Abstract
{

    protected $_dict = array(
            "id" => "id_liens",
            "url" => "url",
            "nom" => "titre",
            "creationDate" => "creation_date",
            "creationUtilisateur" => "creation_utilisateur"
    );

    protected $_dictDate = array(
            "creationDate" => "creation_date"
    );

    /**
     *
     * @see Jnd_Model_Mapper_Abstract::getDataFromDict()
     */
    protected function getDataFromDict (Jnd_Model_Abstract $objetModel)
    {
        if (intval($objetModel->getId()) == 0) {
            $objetModel->setCreationDate(
                    date(Jnd_Global_Constantes::FORMAT_DATE_WEB_LONG));
            $objetModel->setCreationUtilisateur(
                    Zend_Auth::getInstance()->getIdentity()->id_utilisateurs);
        }
        $donnees = parent::getDataFromDict($objetModel);
        return $donnees;
    }
}

